<?php
/**
 * The template for displaying Comments.
 *
 */
?>
<div id="comments" class="grid_24">
	<h2 class="rounded"><?php _e( 'Comments', ns_text_domaine ); ?></h2>
	
	
	<?php if ( post_password_required() ) : ?>
		<p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', ns_text_domaine ); ?></p>
	</div><!-- #comments -->
	<?php
			/* Stop the rest of comments.php from being processed,
			 * but don't kill the script entirely -- we still have
			 * to fully load the template.
			 */
			return;
		endif;
	?>

	<?php // You can start editing here -- including this comment! ?>

	<ol id="comments_list">
			
	<?php 
			// defauls	
			$defaults = array(
				'comment_field'        => '<textarea id="comment" name="comment" autocomplete="off"></textarea>',
				'id_form'              => 'add_new_comment',
				'id_submit'            => 'submit',
				'label_submit'         => __( 'Add the new comment', ns_text_domaine ),
				'comment_notes_before'         => '',
				'comment_notes_after'         => '',
				'must_log_in'          => '<p class="must-log-in">' .  sprintf( 
																		__( '<a href="%s">Log in</a> to post a comment.', ns_text_domaine ), 
										get_option('siteurl') . '/login?redirect_to=' . wp_get_shortlink( $post_id ) )
			);
			
			// added a new field to the form
			function ns_comment_form_before() {
				echo '<li class="rounded comment_form">';
			}
			
			function ns_comment_form_after() {
				echo '</li>';
			}	
			
			// the filter required to do so
			add_action('comment_form_before', 'ns_comment_form_before');
			add_action('comment_form_after', 'ns_comment_form_after');	
			
			if ( have_comments() ) : 
	
				/* Loop through and list the comments. Tell wp_list_comments()
				 * to use twentyeleven_comment() to format the comments.
				 * If you want to overload this in a child theme then you can
				 * define twentyeleven_comment() and that will be used instead.
				 * See twentyeleven_comment() in twentyeleven/functions.php for more.
				 */
				wp_list_comments( array( 'callback' => 'ns_comments' ) );		
				
				
			/* If there are no comments and comments are closed, let's leave a little note, shall we?
			 * But we don't want the note on pages or post types that do not support comments.
			 */
			elseif ( ! comments_open() && ! is_page() && post_type_supports( get_post_type(), 'comments' ) ) :
		?>
				<li><p class="nocomments"><?php _e( 'Comments are closed.', ns_text_domaine ); ?></p></li>
			
		<?php endif; ?>
			
		<?php comment_form( $defaults ); ?>
	
		</ol>
</div>